import request from '@/config/axios'

// 销售线索 VO
export interface SalesLeadVO {
  id: number // 序号
  customerId: number // 关联客户
  contactId: number // 关联联系人ID
  opportunityTitle: string // 机会标题
  demandDescription: string // 需求描述
  estimatedAmount: number // 预订金额
  discoveryTime: Date // 发现时间
  estimatedSignTime: Date // 预订签单时间
  ownerId: number // 归属人员
  ownerName: string // 归属人员ID
  assistantId: string // 协助人员ID
  assistantNames: string // 协助人员ID
  creatorName: string // 创建者
  updaterName: string // 更新者
}

// 销售线索 API
export const SalesLeadApi = {
  // 查询销售线索分页
  getSalesLeadPage: async (params: any) => {
    return await request.get({ url: `/oa/sales-lead/page`, params })
  },

  // 查询销售线索详情
  getSalesLead: async (id: number) => {
    return await request.get({ url: `/oa/sales-lead/get?id=` + id })
  },

  // 新增销售线索
  createSalesLead: async (data: SalesLeadVO) => {
    return await request.post({ url: `/oa/sales-lead/create`, data })
  },

  // 修改销售线索
  updateSalesLead: async (data: SalesLeadVO) => {
    return await request.put({ url: `/oa/sales-lead/update`, data })
  },

  // 删除销售线索
  deleteSalesLead: async (id: number) => {
    return await request.delete({ url: `/oa/sales-lead/delete?id=` + id })
  },

  // 导出销售线索 Excel
  exportSalesLead: async (params) => {
    return await request.download({ url: `/oa/sales-lead/export-excel`, params })
  },
}